Skip to content

Conversation

@lukaszsamson
Copy link
Contributor

Currently warnings from interpolation are written to stdout/err and not reported as code warnings:

iex(2)> Code.with_diagnostics(fn -> Code.string_to_quoted("\"xx\\x4\"") end)
warning: \xH inside strings/sigils/chars is deprecated, please use \xHH (byte) or \uHHHH (code point) instead
{{:ok, <<120, 120, 4>>}, []}
iex(3)> Macro.unescape_string("\"\\x4\"")
warning: \xH inside strings/sigils/chars is deprecated, please use \xHH (byte) or \uHHHH (code point) instead
<<34, 4, 34>>

With this PR:

iex(1)> Code.with_diagnostics(fn -> Code.string_to_quoted("\"xx\\x4\"") end)
{{:ok, <<120, 120, 4>>},
 [
   %{
     message: "\\xH inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead",
     position: {1, 2},
     file: "nofile",
     stacktrace: [],
     span: nil,
     source: "nofile",
     severity: :warning
   }
 ]}
iex(2)> Macro.unescape_string("\"\\x4\"")
<<34, 4, 34>>

@josevalim
Copy link
Member

I am almost sure these were soft-deprecated at v1.0 (or immediately after) and they were left over. I believe we can simply go ahead with remove these clauses. I will take a look at them later.

@josevalim josevalim closed this in 4b48982 Jul 20, 2025
ggVGc pushed a commit to ggVGc/elixir-verbatim that referenced this pull request Sep 12, 2025
Their usage in Elixir v1.0 was always semantically wrong,
which became deprecation warnings in v1.1 to avoid crashes.
Any software relying on this feature both emits warnings
and invalid strings.

Closes elixir-lang#14660.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants